<?php

namespace Modules\Common\Http\Controllers;

use App\Http\Controllers\Controller;
use Modules\Common\Helpers\Traits\QueryBuilder\Fields;
use Modules\Common\Helpers\Traits\QueryBuilder\Filters;
use Modules\Common\Helpers\Traits\QueryBuilder\Includes;
use Modules\Common\Helpers\Traits\QueryBuilder\Sorts;
use Modules\Common\Helpers\Traits\Response;

class CommonController extends Controller
{
    use Response;
    use Fields, Filters, Includes, Sorts;
    public function __construct() {
    }



    protected function page() {
        if (request()->header('all')){
            return $this->qb->get();
        }
        return $this->qb->jsonPaginate();
    }

    protected function get() {
        return $this->qb->get();
    }

    protected function find($item) {
        return $this->qb->find($item->id);
    }
}
